package com.aididi.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Auther: zx.xu
 * @Description:
 */
@FeignClient(name = "nacos-provider",fallback = ConsumerFeignService.ConsumerFeignServiceFallBack.class)
public interface ConsumerFeignService {

    /**
     * 调用生产者接口
     * @param message
     * @return
     */
    @GetMapping("/test/{message}")
    String test(@PathVariable("message") String message);


    @Component
    class ConsumerFeignServiceFallBack implements ConsumerFeignService{

        @Override
        public String test(String message) {
            return "服务调用失败！！";
        }
    }
}
